//---------------------------------------------------------------------
// iSlider.js - Slider UI (plug-in for iAnime.js) 
//   version 0.10 (Dec. 20th, 2007)
//
// License:      MIT License
// Copyright:    Copyright (c) 2007-2008 Satoshi Nakajima
// Project Home: http://code.google.com/p/ianimejs/ 
//---------------------------------------------------------------------

function iSlider(anime, param) {
    var inst = { dx:0, dx2:0, dy:0, dy2:0, duration:500, 
                 effect:'easeinout', tag:'li' };
    for (var key in param) inst[key] = param[key] ;
    var slides = document.getElementById(inst.id).getElementsByTagName(inst.tag);
    for (var i=0; i<slides.length; i++) {
        slides[i].style.left = (slides[i].x_left = i*inst.dx+4) + "px";
        slides[i].style.top = (slides[i].y_left = i*inst.dy+4) + "px";
        slides[i].x_id = i;
        slides[i].onclick = sclick;
    }

    function sclick()
    {
        for (var i = 0; i<slides.length; i++) {
            param = { element:slides[i], 
                      effect:inst.effect, duration:inst.duration };
            if (i<=this.x_id && slides[i].x_open) {
                slides[i].x_open = false;
                param.x = slides[i].x_left;
                param.y = slides[i].y_left;
                anime.add(param);
            }
            if (i>this.x_id && !slides[i].x_open) {
                slides[i].x_open = true;
                param.x = slides[i].x_left + inst.dx2;
                param.y = slides[i].y_left + inst.dy2;
                anime.add(param);
            }
        }
    }
}
